package partner_admin_users

import (
	"gitee.com/theegg/go-brick/app/model/partner/partner_admin/partner_admin_menus"
	"gitee.com/theegg/go-brick/app/model/partner/partner_admin/partner_admin_permissions"
	"gitee.com/theegg/go-brick/app/model/partner/partner_admin/partner_admin_roles"
)

// 表名也是cache的tag
var TableName = "partner_admin_users"

// 管理用户表
type PartnerAdminUsers struct {
	Id          int64  `xorm:"pk autoincr"`
	Email       string `xorm:"varchar(64) notnull unique 'email'"`
	Lang        string `xorm:"varchar(32) notnull default('cn') 'lang'"`
	Username    string `xorm:"varchar(64) notnull 'username'"`
	Password    string `xorm:"varchar(64) notnull 'password'"`
	SecPassword string `xorm:"varchar(64) notnull 'sec_password'"`

	ImageAvatar string `xorm:"varchar(128) null 'image_avatar'"`
	Remark      string `xorm:"varchar(64) null 'remark'"`

	RegisterTime  int64  `xorm:"integer notnull 'register_time'"`
	RegisterIp    string `xorm:"char(15) notnull 'register_ip'"`
	LastLoginTime int64  `xorm:"integer null 'last_login_time'"`
	LastLoginIp   string `xorm:"char(15) null 'last_login_ip'"`

	AddAdminId int64 `xorm:"integer null default(0) 'add_admin_id'"`
	State      int   `xorm:"tinyint default(0) 'state'"`

	// 不参与查询
	ImageAvatarUrl string                                                       `xorm:"-"`
	role           *partner_admin_roles.PartnerAdminRoles                       `xorm:"-"`
	menus          map[int64]*partner_admin_menus.PartnerAdminMenus             `xorm:"-"`
	permissions    map[int64]*partner_admin_permissions.PartnerAdminPermissions `xorm:"-"`
}
